import { EventEmitter } from 'node:events'
import { mixin } from './utils'
import proto from './core/application'
import req from './core/request'
import res from './core/response'


function createApplication() {
  const app = function() {

  }
  
  mixin(app, EventEmitter.prototype, false)
  mixin(app, proto, false)

  app.request = Object.create(req, {
    app:{
      writable:true,
      configurable:true,
      enumerable:true,
      value: app
    }
  })

  app.response = Object.create(res, {
    app:{
      writable:true,
      configurable:true,
      enumerable:true,
      value: app
    }
  })

  return app as Application 
}


export default createApplication
